import { request } from '@ruifox-cms/utils'

//获取菜单功能
export function getMenuFunc(params) {
    return request({
        url: '/auth/menu/getFunc',
        method: 'get',
        params
    })
}
//添加菜单和功能
export function addMenuFunc(data) {
    return request({
        url: '/auth/menu/insert',
        method: 'post',
        data
    })
}
//编辑菜单和功能
export function editMenuFunc(data) {
    return request({
        url: '/auth/menu/update',
        method: 'post',
        data
    })
}
//批量删除菜单或功能
export function deleteMenuFunc(data) {
    return request({
        url: '/auth/menu/deleteList',
        method: 'post',
        data
    })
}
// 菜单条件查询
export function getMenuList(params) {
    return request({
        url: '/auth/menu/selectList',
        method: 'get',
        params
    })
}
//获取角色列表
export function getRolePage(params) {
    return request({
        url: '/auth/role/selectPage',
        method: 'get',
        params
    })
}
//获取用户自身创建的角色
export function getRoleCratedBySelf(params) {
    return request({
        url: '/auth/role/selectByCreator',
        method: 'get',
        params
    })
}
//获取所有角色
export function getRoleList(params) {
    return request({
        url: '/auth/role/selectList',
        method: 'get',
        params
    })
}
//添加角色
export function addRole(data) {
    return request({
        url: '/auth/role/insert',
        method: 'post',
        data
    })
}
//编辑角色
export function editRole(data) {
    return request({
        url: '/auth/role/update',
        method: 'post',
        data
    })
}
//删除角色
export function deleteRole(data) {
    return request({
        url: '/auth/role/delete',
        method: 'post',
        data
    })
}
//根据角色获取菜单权限列表
export function getMenuByRoleId(params) {
    return request({
        url: '/auth/role/getMenu',
        method: 'get',
        params
    })
}
//设置角色菜单权限
export function setRolePermission(data) {
    return request({
        url: '/auth/role/setMenu',
        method: 'post',
        data
    })
}
//设置角色接口权限
export function setRoleAuthority(data) {
    return request({
        url: '/auth/role/setAuthority',
        method: 'post',
        data
    })
}
//设置默认权限
export function setRoleDefaultPermission(data) {
    return request({
        url: '/auth/menu/setDefault',
        method: 'post',
        data
    })
}
// 根据用户id获取菜单权限
export function getMenuByUserId(params) {
    return request({
        url: '/auth/menu/selectByUserId',
        method: 'get',
        params
    })
}
//获取当前菜单下的所有功能页面
export function getFunMenu(params) {
    return request({
        url: '/auth/role/menu/getFunMenu',
        method: 'get',
        params
    })
}
//获取当前菜单下的所有功能页面
export function getInterfacePermi(params) {
    return request({
        url: '/auth/menu/getInterfacePermission',
        method: 'get',
        params
    })
}
//解绑角色
export function unBindRole(params) {
    return request({
        url: '/auth/feign/role/unBindRole',
        method: 'get',
        params
    })
}
//批量解绑角色
export function batchUnBindRole(data) {
    return request({
        url: '/auth/role/unBindUserRoleList',
        method: 'post',
        data
    })
}
